package com.weasel.helper;

import java.util.Collection;

/**
 * @author Dylan
 * @mail pickear@gmail.com
 * @time 2014年4月21日
 */
public final class LangHelper {

	private LangHelper(){}
	
	/**if not null actual,return it,else ,return safe;so safe can not be null
	 * @param actual
	 * @param safe
	 * @return
	 */
	public static <T> T nullSafe(T actual,T safe){
		
		return null != actual ? actual : safe;
	}
	
	/**
	 * return the collection is empty or not
	 * if param is null,return false
	 * if param is empty,return false
	 * if param is not empty,return true
	 * @param collection
	 * @return
	 */
	public static boolean notEmpty(Collection<?> collection){
		
		return null != collection && !collection.isEmpty();
	}
}
